# -*- coding: utf-8 -*-
from datetime import timedelta
from utils.operators.spark_submit import SparkSubmitOperator
from jms.dm.route.dm_route_selected_all_dt import jms_dm__dm_route_selected_all_dt

dm__dm_route_whole_selected = SparkSubmitOperator(
    conn_id='spark_route',
    task_id='dm__dm_route_whole_selected',
    pool_slots=5,
    email=['zhangqinglin@jtexpress.com','yl_bigdata@yl-scm.com'],
    name='dm__dm_route_whole_selected',
    driver_memory='10G',
    executor_memory='10G',
    executor_cores=2,
    num_executors=100,
    conf={
          'spark.sql.sources.partitionOverwriteMode': 'dynamic',  # 允许删改已存在的分区
          'spark.executor.memoryOverhead': '4G',  # 堆外内存
          'spark.sql.shuffle.partitions': 500,
          'spark.reducer.maxSizeInFlight':96,
          'spark.shuffle.file.buffer':64
          },
    jars='hdfs:///route/package/graphframes-0.7.0-spark2.3-s_2.11.jar,hdfs:///route/package/common-1.0-SNAPSHOT.jar',
    java_class='com.yunlu.bigdata.jobs.route.export.SelectedRouteExport',
    application='hdfs:///route/package/selected/original-jobs-1.0-SNAPSHOT.jar',
    application_args=['{{ execution_date | cst_ds }}'],
    execution_timeout=timedelta(hours=2),
)


dm__dm_route_whole_selected << jms_dm__dm_route_selected_all_dt
